/**
 * 
 */
package UnitTests;

import static org.junit.Assert.*;
import junit.framework.Assert;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import RefactoringA1.src.CreditCard;

/**
 * @author Thomas
 *
 */
public class CreditCardTest {

	/**
	 * A CreditCard for testing.
	 */
	CreditCard cc1;
	
	/**
	 * A CreditCard for testing.
	 */
	CreditCard cc2;
	
	
	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		cc1 = new CreditCard("Bobby", "Maple", "98500", "Anytown", "usa", 250);
		cc2 = new CreditCard("Bobby", "Maple", "98500", "Anytown", "usa", 50000.00);
	}

	/**
	 * Test method for {@link RefactoringA1.src.CreditCard#CreditCard(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)}.
	 */
	@Test
	public void testCreditCardStringStringStringStringString() {
		Assert.assertTrue(cc1 instanceof CreditCard);
	}

	/**
	 * Test method for {@link RefactoringA1.src.CreditCard#CreditCard(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, double)}.
	 */
	@Test
	public void testCreditCardStringStringStringStringStringDouble() {
		Assert.assertTrue(cc2 instanceof CreditCard);
	}

	/**
	 * Test method for {@link RefactoringA1.src.CreditCard#pay(double)}.
	 */
	@Test
	public void testPay() {
		Assert.assertTrue(cc1.pay(2501.00));
		Assert.assertFalse(cc2.pay(5001.00));
	}

	/**
	 * Test method for {@link java.lang.Object#Object()}.
	 */
	@Test
	public void testObject() {
		Assert.assertTrue(cc1 instanceof CreditCard);
		Assert.assertTrue(cc2 instanceof CreditCard);
	}

	/**
	 * Test method for {@link java.lang.Object#getClass()}.
	 */
	@Test
	public void testGetClass() {
		Assert.assertTrue(cc1.getClass().getSimpleName().equals("CreditCard"));
	}

	/**
	 * Test method for {@link java.lang.Object#equals(java.lang.Object)}.
	 */
	@Test
	public void testEquals() {
		Assert.assertTrue(cc1.equals(cc1));
		Assert.assertFalse(cc1.equals(cc2));
	}
}
